import { BasicColumn, FormSchema } from '/@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: 'id',
    dataIndex: 'id',
    width: 150,
    defaultHidden: true
  },
  {
    title: '场景名称',
    dataIndex: 'name',
    width: 150,
  },

  {
    title: '标识',
    dataIndex: 'code',
    width: 150,
  },

  {
    title: '创建者',
    dataIndex: 'createdBy',
    width: 100,
  },

  {
    title: '创建时间',
    dataIndex: 'createdAt',
    width: 100,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    colProps: { span: 8 },
  }
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
  },
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'code',
    label: '标识',
    component: 'Input',
    required: true,
    dynamicDisabled: ({values}) => {
      return !!values.id;
    },
  },
  {
    field: 'remark',
    label: '备注',
    componentProps: {
      placeholder: '请输入备注',
      rows: 5,
    },
    component: 'InputTextArea',
  },
]
